package com.yurui.proxy.springaop;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;

import java.util.Arrays;
import java.util.Date;

public class LogAspect {

    public void beforeAdvice(JoinPoint joinPoint){
        System.out.println("前置通知。。。。");
//        System.out.println("args="+ Arrays.toString(joinPoint.getArgs()));
//        System.out.println("kind="+joinPoint.getKind());
//        System.out.println("joinPoint.toLongString()="+joinPoint.toLongString());
//        System.out.println("joinPoint.getSignature()="+joinPoint.getSignature());
//        System.out.println("joinPoint.getSourceLocation()="+joinPoint.getSourceLocation());
//        System.out.println("joinPoint.getStaticPart()="+joinPoint.getStaticPart());
//        System.out.println("joinPoint.getTarget()="+joinPoint.getTarget());
//        System.out.println("joinPoint.getThis()="+joinPoint.getThis());

    }
    public void beforeAdvice02(JoinPoint joinPoint){
        System.out.println("前置通知。。。。02");
//        System.out.println("args="+ Arrays.toString(joinPoint.getArgs()));
//        System.out.println("kind="+joinPoint.getKind());
//        System.out.println("joinPoint.toLongString()="+joinPoint.toLongString());
//        System.out.println("joinPoint.getSignature()="+joinPoint.getSignature());
//        System.out.println("joinPoint.getSourceLocation()="+joinPoint.getSourceLocation());
//        System.out.println("joinPoint.getStaticPart()="+joinPoint.getStaticPart());
//        System.out.println("joinPoint.getTarget()="+joinPoint.getTarget());
//        System.out.println("joinPoint.getThis()="+joinPoint.getThis());

    }

    public void afterAdvice(JoinPoint joinPoint){
        System.out.println("后置通知。。。。");
//        System.out.println("args="+ Arrays.toString(joinPoint.getArgs()));
//        System.out.println("kind="+joinPoint.getKind());
//        System.out.println("joinPoint.toLongString()="+joinPoint.toLongString());
//        System.out.println("joinPoint.getSignature()="+joinPoint.getSignature());
//        System.out.println("joinPoint.getSourceLocation()="+joinPoint.getSourceLocation());
//        System.out.println("joinPoint.getStaticPart()="+joinPoint.getStaticPart());
//        System.out.println("joinPoint.getTarget()="+joinPoint.getTarget());
//        System.out.println("joinPoint.getThis()="+joinPoint.getThis());

    }


    public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
        System.out.println("环绕通知。。。。前");
        Object a = joinPoint.proceed();
        System.out.println("环绕通知。。。。后");
        return a;
    }
}
